﻿using System;
using System.Collections.Generic;
using System.Text;

namespace StarBotDotNet.BuildStateCheckers
{
    public class StateCheckerFinished:StateCheckerAbstract
    {
        protected override bool CanEnterThisState(IBuildingParty buildingParty, BuildTarget target, StarBotDotNet.ProxyBot bot, UnitDictionary currentUnits, int currentTime)
        {
            return true;

            //if (target.Builder != null)
            //{
            //    if (target.UnitProduced != null)
            //    {

            //        if (target.Builder.IsIdle && target.UnitProduced.Unit.IsCompleted)
            //        {
            //            if (target.IsOverdue(currentTime))
            //            {
            //                return true;
            //            }

            //        }
            //    }
            //}
            //return false;
        }

        protected override bool CanTryToMoveToThisState(IBuildingParty buildingParty, BuildTarget target, StarBotDotNet.ProxyBot bot, UnitDictionary currentUnits, int currentTime)
        {
            if (target.UnitProduced!=null)
            {
                if (target.UnitProduced.Unit.IsCompleted)
                {
                    return true;
                }
            }
            return false;
            
        }

        protected override void InitiateMovingToThisState(IBuildingParty buildingParty, BuildTarget target, StarBotDotNet.ProxyBot bot, UnitDictionary currentUnits, int currentTime)
        {
            
        }

        protected override void PrepareInitiationOfMovingToThisState(IBuildingParty buildingParty, BuildTarget target, StarBotDotNet.ProxyBot bot, UnitDictionary currentUnits, int currentTime)
        {
            // buildingParty.DiscoveredUnhandled)


        }

        public override BuildStateEnum StateFrom
        {
            get { return BuildStateEnum.b5_UnderProduction; }
        }

        public override BuildStateEnum StateTo
        {
            get { return BuildStateEnum.b8_Finished; }
        }
    }
}
